window.onload = function() {
    var telReg = /^1[3|5|7|8|9]\d{9}$/; //手机号正则表达式
    var tel = document.querySelector("#tel");
    testReg(tel, telReg);
    var msgReg = /^\d{6}$/;
    var msg = document.querySelector("#mes");
    testReg(msg, msgReg);

    function testReg(ele, reg) {
        ele.onblur = function() {
            if (reg.test(this.value)) {
                // console.log("true");
                this.nextElementSibling.className = 'success';
                this.nextElementSibling.innerHTML = '<i class="success_icon"></i>正确';
            } else {
                // console.log("false");
                this.nextElementSibling.className = 'error';
                this.nextElementSibling.innerHTML = '<i class="error_icon"></i>输入错误';
            }
        }

    }


}